package com.playjoy.dao;

import com.playjoy.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;


/**
 * Created by asus on 2016/11/8.
 */
@Repository
public interface UserRepository extends JpaRepository<User, Long> {

    User findById(int id);

    User findByName(String name);

    User findByAgeAndName(int age,String name);

    @Query("from User u where u.name=:name")
    User findUser(@Param("name") String name);

}
